/**
 * <p>ajax辅助类</p>
 * xtype = cceafysjajaxhelper

 * @module Ext-ux-cceaf-util-ysj
 * @class cceaf.util.ysj.YsjAjaxHelper
 * @extends Object
 * @static
 * @since 1.0
 */
Ext.ns('cceaf.util.ysj');

Ext.define('cceaf.util.ysj.YsjAjaxHelper',{
	//extjs cmd只能通过类查找，需定义空类
});

cceaf.util.ysj.YsjAjaxHelper = (function() {
	
	return {
		
		/**
		 * 根据数据库ID得到数据库名称
		 * 
		 * @param {Number} sjkbh 数据库ID
		 * @return {String} 数据库名称
		 */
		getSjkName: function(sjkbh){
			var sjkName = "";

			if(sjkbh != null){  
				Ext.Ajax.request({
					url: 'ysj/jghSjk!getSjkNameBySjkbh.action',
					async: false,
					success: function(response){
						var responseText = response.responseText.ltrim();
						var json = Ext.decode(responseText);
						if (json.success) {
							sjkName = json.message;
							return sjkName;
						} else {
							//cceaf.util.showErrorDialog(json.message, json.url);
							sjkName = "";
							return sjkName;
						}
					},
					params: {sjkbh:sjkbh}
				});
		    }
			
			return sjkName;
		},
	
		/**
		 * 根据表ID得到表中文名称
		 * 
		 * @param {Number} bid表ID
		 * @return {String} 表中文名称
		 */
		getBzwmc: function(bid){
			var bzwmc = "";
	
			if(bid != null){  
				Ext.Ajax.request({
					url: 'ysj/jghSjb!getBzwmcByBid.action',
					async: false,
					success: function(response){
						var responseText = response.responseText.ltrim();
						var json = Ext.decode(responseText);
						if (json.success) {
							bzwmc = json.message;
							return bzwmc;
						} else {
							//cceaf.util.showErrorDialog(json.message, json.url);
							bzwmc = "";
							return bzwmc;
						}
					},
					params: {bid:bid}
				});
		    }
			
			return bzwmc;
		}
	};
}());